package edu.ccut.saturn.basecomponent.database.impl.hsql.builder;

import java.sql.Connection;

import edu.ccut.saturn.basecomponent.database.ISaturnSQL;
import edu.ccut.saturn.basecomponent.database.SaturnSQLBuilderFactory;
import edu.ccut.saturn.basecomponent.database.impl.AbstractInsertSQLBuilder;
import edu.ccut.saturn.component.IDataItem;
import edu.ccut.saturn.component.SaturnComponentException;
import edu.ccut.saturn.component.SaturnData;

/**
 * SqlServer插入大数据的sql语句,使用PreparedStatement执行语句
 * @author zjh
 *
 */

public class HsqlInsertSQLBuilder extends AbstractInsertSQLBuilder {
		
	@Override
	protected String getColumnValueString(IDataItem iDataItem, Object value) {
		return "?,";
	}
	/**
	 * 获得数据库类型
	 * @author zjh
	 * @return sqlserver
	 */
	@Override
	protected String getDatabaseType() {
		return SaturnSQLBuilderFactory.HSQL;
	}
	/**
	 * 得到操作类型
	 * @author zjh
	 * @return INSERT.LOB
	 */
	@Override
	protected String getOperationType() {
		return ISaturnSQL.INSERT_OPERATION;
	}
	/**
	 * 得到当前主键值的sql语句
	 * @author zjh
	 * @return sql语句
	 */	
	@Override
	protected String getPrimerKeySql(IDataItem dataItem) {
		return "CALL IDENTITY()";
	}
	
	/**
	 * 重写设置主键值方法,Hsql无法在此设置主键值
	 * @author zjh
	 * @param saturnData
	 * @param conn 
	 */
	@Override
	protected void setPrimerKey(SaturnData saturnData, Connection conn)
			throws SaturnComponentException {
		
	}
}
